<template>
	<NavBar :obj="{ title: '设置', color: '#000', backgroundColor: '#fff' }" />
	<view class="container">
		<view class="main">
			<view class="main_li" @click="goUrl('/pages/user/set/setting-info')">
				个人资料
				<u-icon name="arrow-right" color="#888" size="16"></u-icon>
			</view>
		</view>

		<!-- <view class="main">
			<view class="main_li" @click="goUrl('/pages/user/set/password')">
				安全中心
				<u-icon name="arrow-right" color="#888" size="16"></u-icon>
			</view>
		</view> -->

		<!-- <view class="main">
			<view class="main_li" @click="goUrl('/pages/address/index')">
				地址管理
				<u-icon name="arrow-right" color="#888" size="16"></u-icon>
			</view>
			<view class="main_li" @click="goUrl('/pages/user/set/method-list')">
				收款方式
				<u-icon name="arrow-right" color="#888" size="16"></u-icon>
			</view>
		</view> -->

		<view class="main">
			<view class="main_li" @click="goUrl('/pages/agreement?type=register_msg&title=用户协议')">
				用户协议
				<u-icon name="arrow-right" color="#888" size="16"></u-icon>
			</view>
			<view class="main_li" @click="goUrl('/pages/agreement?type=privacy_msg&title=隐私政策')">
				隐私政策
				<u-icon name="arrow-right" color="#888" size="16"></u-icon>
			</view>
		</view>

		<view class="main">
			<view class="main_li" @click="goUrl('/pages/agreement?type=company&title=关于我们')">
				关于
				<u-icon name="arrow-right" color="#888" size="16"></u-icon>
			</view>
		</view>

		<view class="logout" @click="logout">退出登录</view>
	</view>
</template>

<script setup>
	import { ref, inject } from 'vue';
	import { port, imgUrl, goUrl, hint, loading, closeLoading } from '/service/port';
	import { onLoad, onShow } from '@dcloudio/uni-app';
	onShow(() => {
		
	});

	async function logout() {
		uni.showModal({
			title: '请确认',
			content: '确定要退出登录吗？',
			confirmColor: '#F81A2E',
			success: async function (res) {
				if (res.confirm) {
					loading();

					setTimeout(() => {
						closeLoading();
						uni.removeStorageSync('token');
						uni.reLaunch({
							url: '/pages/login'
						});
					}, 400);
				}
			}
		});
	}
</script>

<style scoped lang="scss">
	:global(page) {
		background-color: #f4f5f8;
	}
	.container {
		margin: 0 30upx;
		.main {
			background: #fff;
			border-radius: 20upx;
			margin-top: 30upx;
			.main_li {
				color: #000;
				font-size: 28upx;
				display: flex;
				justify-content: space-between;
				line-height: 100upx;
				view {
					color: #888;
					display: flex;
				}
			}
		}
		.logout {
			margin-top: 100upx;
			color: #aaa;
			background: #fff;
			text-align: center;
			line-height: 90upx;
			border-radius: 20upx;
		}
	}
</style>
